﻿using System;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;

namespace Hostblock
{
    internal static class Program
    {
        /// <summary>
        /// Der Haupteinstiegspunkt für die Anwendung.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Autoupdate();
            Application.Run(new Mainform());
        }
    
        private static void Autoupdate()
        {
            String Params = @"hostblock Hostblock 2.8 Prompt DirectDL";
            //The rest is to remain
            String UpdaterFileName = @"Codeplex MSI Autoupdate.exe";
            String PathInProjectFolder = Path.Combine(@"..\..\..\Codeplex MSI Autoupdate\bin\release", UpdaterFileName);
            String PathInInstallFolder = Path.Combine(Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]), UpdaterFileName);
            if (File.Exists(PathInInstallFolder))
                Process.Start(PathInInstallFolder, Params);
            else if (File.Exists(PathInProjectFolder))
                Process.Start(PathInProjectFolder, Params);
            else
                MessageBox.Show("Missing Codeplex MSI Autoupdate");
        }
    }
}